<?php
class Error{

	public static function exceptionHandler( Exception $exception ){
		self::errorMessage( $exception );
	}

	private static function errorMessage( $exception ){
		$message = nl2br($exception->getMessage());
		$code = $exception->getCode();

		switch($code){

			case 404:
				$message = "page not found";
				break;
				
			case 500:
				$message = "server error";
				break;

			default:
				$message = "error";
		}
		echo 
<<<EOF
<!DOCTYPE html>
<head>
<title>{$code}</title>
</head>
<body>
<div style="font-size:24px;">
<p>error code: {$code}</p>
<p>error message: {$message}</p>
</div>
</body>
</html>
EOF;
	exit;
	}
}
